package com.yxb.cms.controller.api;


import com.yxb.cms.architect.constant.BussinessCode;
import com.yxb.cms.architect.utils.BussinessMsgUtil;
import com.yxb.cms.domain.dto.BussinessMsg;
import com.yxb.cms.domain.vo.DbAuthManager;
import com.yxb.cms.service.AuthManagerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * api接口示例
 */
@Api(tags = "api接口示例", description = "api接口示例",position = 1)
@RestController
@RequestMapping(value = "/api")
@Log4j2
public class DemoControllerApi {


    @Autowired
    private AuthManagerService managerService;


    @ApiOperation(notes = "示例", value = "示例",position = 1)
    @RequestMapping(value = "/demo", method = {RequestMethod.POST})
    @ApiImplicitParam(name = "authKey", value = "统计日期", dataType = "String", required = true, paramType = "query")
    @ResponseBody
    public BussinessMsg schoolDataQuery(@RequestParam(value = "authKey") String authKey) {
        try {
            DbAuthManager authManager = managerService.selectAuthManager(authKey);
            return BussinessMsgUtil.returnCodeMessage(BussinessCode.GLOBAL_SUCCESS,authManager);
        } catch (Exception ex) {
            log.error("方法内部错误{}", ex.getMessage(), ex);
            return BussinessMsgUtil.returnCodeMessage(BussinessCode.GLOBAL_ERROR);
        }
    }










}
